package com.ColonyCount.Image;

import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;

public class ImageRegion {
	Point[] points;
	Rect bounds = new Rect();
	int color;      
	
	public ImageRegion(Point[] points, int color)
	{
		this.color = color;
		this.points = points;
		bounds.set(Integer.MAX_VALUE,Integer.MAX_VALUE,0,0);
		for(int i=0;i<points.length;i++)
		{
			bounds.left = Math.min(bounds.left, points[i].x);
			bounds.right = Math.max(bounds.right, points[i].x);
			bounds.top = Math.min(bounds.top, points[i].y);
			bounds.bottom = Math.max(bounds.bottom, points[i].y);
		}
	}
	
	public Rect getBounds()
	{
		return bounds;
	}
	
	public int getColor()
	{
		return color;
	}
	
	public Point[] getPoints()
	{
		return points;
	}
	
	public void offset(int x, int y)
	{
		for(int i=0;i<points.length;i++)
		{
			points[i].x += x;
			points[i].y += y;
		}
	}
	
	public int getSize()
	{
		return points.length;
	}
}
